﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Windows.Forms;

namespace rock.UI.common
{
   public class FileUtils
    {

       public static void CopyTo(String src, String desc) {
           try
           {
               Directory.CreateDirectory("contact_dir/");
           }
           catch (Exception)
           {
               
              // throw;
           }
           try
           {

           // Create the file and clean up handles.
           using (FileStream fs = File.Create(src)) { }

           // Ensure that the target does not exist.
           
               File.Delete(desc);


               // Copy the file.
               File.Copy(src, desc);


               // Try to copy the same file again, which should succeed.
               File.Copy(src, desc, true);
            
           }
           catch (Exception)
           {
               
              // throw;
           }
          

           
       }

       public static void openDox(String docName)
       {
           System.Diagnostics.ProcessStartInfo info = new System.Diagnostics.ProcessStartInfo();
           System.Diagnostics.Process proc = new System.Diagnostics.Process();
           //设置外部程序名(记事本用 notepad.exe 计算器用 calc.exe) 
           info.FileName = docName;
           //设置外部程序的启动参数
          // info.Arguments = "";
           //设置外部程序工作目录为c:\windows
          // info.WorkingDirectory = "c:/windows/";
           try
           {
               // 
               //启动外部程序 
               // 
               proc = System.Diagnostics.Process.Start(info);
           }
           catch
           {
               MessageBox.Show("系统找不到指定的程序文件", "错误提示！");
               return;
           }
       }

    }

   



}
